﻿using Volo.Abp.Emailing;
using Volo.Abp.Settings;

namespace Coway.Ordering.Settings
{
    public class OrderingSettingDefinitionProvider : SettingDefinitionProvider
    {
        public override void Define(ISettingDefinitionContext context)
        {
            context.Add(GetEmailSettings()); // 发送邮件配置
        }

        public SettingDefinition[] GetEmailSettings()
        {
            /************************************************************************ 
             * UserName即为QQ邮箱名，但Password并不是你QQ邮箱的登陆密码，
             * 而是授权码。授权码如何申请，请参考官方文档。https://service.mail.qq.com/cgi-bin/help?subtype=1&&no=1001256&&id=28
             * 否则发送邮件将会得到[Error: need EHLO and AUTH first !”] 异常。
             ************************************************************************/
            return new SettingDefinition[]{
                new SettingDefinition(EmailSettingNames.Smtp.Host, "smtp.qq.com"),
                new SettingDefinition(EmailSettingNames.Smtp.Port, "587"),
                new SettingDefinition(EmailSettingNames.Smtp.UserName, "172787851@qq.com"),
                new SettingDefinition(EmailSettingNames.Smtp.Password, "nhfjpevnhuuobgda"),
                new SettingDefinition(EmailSettingNames.Smtp.Domain,""),
                new SettingDefinition(EmailSettingNames.Smtp.EnableSsl, "false"),
                new SettingDefinition(EmailSettingNames.Smtp.UseDefaultCredentials, "false"),
                new SettingDefinition(EmailSettingNames.DefaultFromAddress, "172787851@qq.com"),
                new SettingDefinition(EmailSettingNames.DefaultFromDisplayName, "报表预约邮件通知")
            };
        }
    }
}
